-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LaTeX support for argmin-testfunctions docs #530
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #530 +/- ##
=======================================
Coverage 91.49% 91.49%
=======================================
Files 178 177 -1
Lines 23623 23621 -2
=======================================
- Hits 21613 21612 -1
+ Misses 2010 2009 -1 ☔ View full report in Codecov by Sentry. |
Setting There's a similar issue with a similar workaround for the Open point: is it preferable to set |
Firstly, this is an absolutely magnificent PR, both in terms of work done and description! Thank you for the massive effort you have taken to make this work! Do I understand it correctly that the main problem is that both
Would this fix the discrepancy between The failing clippy lints should be fixed in main. |
b7eb0c2
to
966c27d
Compare
Thanks for the feedback!
Yes, that's correct.
It would remove the workarounds for diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index bbd3a70c..affe0c1f 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -19,6 +19,8 @@ jobs:
components: rustfmt,rust-src
- name: Build documentation
+ env:
+ RUSTDOCFLAGS: "--html-in-header ./crates/argmin-testfunctions/katex-header.html"
run: cargo doc --features "argmin-math/latest_all,argmin/full" --no-deps --workspace --exclude "example-*"
- name: Forwarding Caveats:
Thanks! I rebased the branch on |
This patch adds LaTeX/KaTeX support to the
argmin-testfunctions
crate documentation.The HTML code in
argmin-testfunctions/katex-header.html
is added to the header of all the documentation pages in that crate and loads the KaTeX auto-render extension from the recommended CDN. It may be possible to serve the KaTeX code from local files but I didn't investigate this.As an example, the documentation of a couple of test function is migrated to using KaTeX rendering. For example that of the
ackley
function:If it is acceptable, the migration of other documentation pages shall be done in subsequent PRs.
As a fly-by, I added some missing cross links and fixed some typos. This patch doesn't contain any Rust code changes.
Resolves #418.
Local build
The workspace's top-level Cargo configuration sets the
RUSTDOCFLAGS
to include the HTML header in all docs pages. This enables KaTeX support for the documentation of all crates for local builds. This is misleading because there's no support in thedocs.rs
build for crates other thanargmin-testfunctions
(see below). Unfortunately, Cargo does not read config files from crates within the workspace so there's no easy way to restrict that configuration to a single crate while keeping the unified workspace build.docs.rs
buildThe
docs.rs
build was tested on adocs.rs
development build. Thedocs.rs
build is configured through data in thepackage.metadata.docs.rs
table in the crate's manifest. Workspace metadata is not supported. Also, the referenced files must be part of the crate, so enabling support for other crates would probably require duplicating thekatex-header.html
file to the other crates, which is a bit of a maintenance burden.Error handling
Syntax errors in the KaTeX code unfortunately only lead to broken rendering. Since the KaTeX code is interpreted in the browser, it may be quite involved to automatically propagate errors to the
rustdoc
call.Reference
https://github.com/victe/rust-latex-doc-minimal-example (and many other publicly available crates)